package org.study.mybatisplus.dynamic.boot.config;

import com.google.common.collect.*;
import lombok.Data;
import org.springframework.stereotype.Component;
import org.study.mybatisplus.dynamic.boot.model.IotDevice;
import org.study.mybatisplus.dynamic.boot.model.IotDeviceProperty;

import java.util.List;
import java.util.Map;

/**
 * 设备、属性、告警配置本地缓存工具类
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2025年10月20日
 */
@Data
@Component
public class LocalCacheConfig {
    /**
     * 设备本地缓存：Map<gatewayNo:deviceNo, IotDevice>
     */
    private Map<String, IotDevice> deviceMap = Maps.newHashMap();

    /**
     * 属性本地缓存：Map<gatewayNo:deviceNo, Map<propertyNo, IotDeviceProperty>>
     */
    private Map<String, Map<String, IotDeviceProperty>> propertyMapMap = Maps.newHashMap();

    /**
     * 属性本地缓存：Map<gatewayNo:deviceNo, List<IotDeviceProperty>>
     */
    private Map<String, List<IotDeviceProperty>> propertyListMap = Maps.newHashMap();

    /**
     * 属性本地缓存：Map<gatewayNo, Map<deviceNo, List<IotDeviceProperty>>>
     */
    private Multimap<String, Map<String, List<IotDeviceProperty>>> propertyMultimap = ArrayListMultimap.create();
}
